--不容遗漏
local burongyilou = fk.CreateSkill {
    name = "mcdh_burongyilou"
}

local U = require "packages/utility/utility"
local lib = require "packages/mcdh/lib"

burongyilou:addEffect(fk.EventPhaseStart,{
    can_trigger = function(self, event, target, player, data)
        return player:hasSkill(self) and player == target and player.phase == Player.Play and not player:isKongcheng()
                and table.find(player.room.alive_players, function (p) return player:canPindian(p) end)
    end,
    on_cost = function (self, event, target, player, data)
        local room = player.room
        local targets = table.filter(player.room.alive_players, function (p) return player:canPindian(p) end)
        local tos = room:askToChoosePlayers(player, {
            targets = targets,
            min_num = 1,
            max_num = 1,
            prompt = "mcdh_burongyilou-choose",
            skill_name = self.name,
            cancelable = true
        })
        if #tos > 0 then
            self.cost_data = tos[1]
            return true
        end
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        local to = self.cost_data
        local pindian = player:pindian({to}, self.name)
        local winner = pindian.results[to].winner
        if winner == player and not to:isKongcheng() then
            local id = room:askForCardChosen(player, to, {card_data = { { "$Hand", to:getCardIds(Player.Hand) } } }, self.name)
            room:throwCard(id, self.name, to, player)
        else
            local mark = player:getTableMark( "burongyilou_prohibit-turn")
            table.insert(mark, to.id)
            room:setPlayerMark(player, "burongyilou_prohibit-turn", mark)
        end
    end,
})

burongyilou:addEffect('prohibit',{
    is_prohibited = function(self, player, to, card)
        return table.contains(player:getTableMark( "burongyilou_prohibit-turn"), to.id)
    end,
})

Fk:loadTranslationTable {
    ["mcdh_burongyilou"] = "不容遗漏",
    [":mcdh_burongyilou"]= "出牌阶段开始时,你可以与一名其他角色拼点,若你赢,你观看其手牌并弃置其中一张;若你没赢,你本回合不能对其使用牌。",
    ["mcdh_burongyilou-choose"] = "不容遗漏:你可以与一名其他角色拼点,若你赢,你观看其手牌并弃置其中一张;若你没赢,你本回合不能对其使用牌。"
}

return burongyilou